package cn.crex1.springboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.crex1.springboot.pojo.Application;
import cn.crex1.springboot.pojo.User;

/**  
* <p>title: UserController</p>  
* <p>description: </p>  
* @author zzh  
* @date 2018年7月18日  
*/
@Controller
public class UserController {
	
	@Autowired
	private  User user;
	
	@Autowired
	private Application application;
	
//	@Autowired
//	private Test test;
	
	@RequestMapping("/user")
	@ResponseBody
	public String sayHello() {
		return "hello world" +"\n"+user+"\n"+application;
	}
	
	@GetMapping("/user/{id}")
	public String getUserinfo(@PathVariable Long id,ModelMap map) {
		map.addAttribute("name", "zhangsan");
		map.addAttribute("age", 20);
		return "user";
		
	}
}
